﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Text;
using predic.Web.Host.Model;

namespace predic.Web.Converter
{
    public class SummaryConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is predic.Web.Host.Model.Study)
            {
                return BuildSummary((Study)value);
            }

            return "----";
        }

        private const string formatSummaryStart = "{0}:{1} ";

        private string BuildSummary(predic.Web.Host.Model.Study study)
        {
            StringBuilder summaryBuilder = new StringBuilder();

            //summaryBuilder.Append(string.Format(formatSummaryStart, "Predicator", study.Preacher.FullName));

            summaryBuilder.Append(string.Format(formatSummaryStart, "Titlu", study.Title));

            summaryBuilder.Append(string.Format(formatSummaryStart, "Subtitlu", study.Subtitle));

            return summaryBuilder.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
        }
    }
}
